package com.window24.command;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 演示服务调用的多种方式
 * Created by yuanfei on 2017/6/5.
 */
@Component
@Slf4j
public class DemoCommand {

    @HystrixCommand(fallbackMethod = "defaultProcess")
    public Object getSomething(Map<String, Object> params) {

        //throw new RuntimeException("假装执行遇到了异常!");
        return params.get("door");
    }

    public Object defaultProcess(Map<String, Object> params) {

        return "当调用失败/异常时默认的异常处理函数";
    }
}